<?php
/** [留言控制器]
 * @Author: 976123967@qq.com
 * @Date:   2015-01-16 11:33:22
 * @Last Modified by:   Administrator
 * @Last Modified time: 2015-01-19 13:14:57
 */
class FeedbackAction extends PublicAction{

	public $logic;

	/**
	 * [_initialize 初始化]
	 * @return [type] [description]
	 */
	public function _initialize()
	{
		parent::_initialize();
		$this->logic = D('Feedback','Logic');
		
	}

	/**
	 * [index 所有留言]
	 * @return [type] [description]
	 */
	public function index()
	{
		$data = $this->logic->get_all();
		if($data)
		{
			$this->assign('page',$data['page']);
			unset($data['page']);
		}
		$this->assign('data',$data);
		$this->display();
	}

	/**
	 * [edit 编辑]
	 * @return [type] [description]
	 */
	public function edit()
	{
		$field = $this->logic->find_one();
		if(!$field) 
			$this->error($this->logic->getError());
		$this->logic->update_lookstate();
		$this->assign('field',$field);
		$this->display();
	}

	/**
	 * [del 删除]
	 * @return [type] [description]
	 */
	public function del()
	{
		if(!$this->logic->del_feedback()) 
			$this->error($this->logic->getError());

		$this->success('留言删除成功',U('Feedback/index'));
	}


	/**
	 * [operation 批量操作数据]
	 * @return [type] [description]
	 */
	public function operation()
	{
		if(!$msg = $this->logic->operation())
			$this->error($this->logic->getError());
		$this->success($msg,U('Feedback/index'));
	}


}